package com.itheima.mapper;

import com.itheima.pojo.Clazz;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ClazzMapper {
    List<Clazz> list(String name, LocalDate begin, LocalDate end);

    @Select("select * from clazz where id=#{id}")
    Clazz queryById(Integer id);

    @Insert("insert into clazz values (null,#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},now(),now())")
    void addClazz(Clazz clazz);

    @Update("update clazz set name=#{name},room=#{room},begin_date=#{beginDate},end_date=#{endDate},master_id=#{masterId},subject=#{subject},update_time=now() where id=#{id}")
    void updateClazz(Clazz clazz);

    @Delete("delete from clazz where id= #{id}")
    void deleteClazz(Integer id);
}
